package com.hzlj.position.config.dao;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fz.common.base.converter.QueryWrapperConverterPlus;
import com.hzlj.position.config.common.dto.jgBj.JgBjQueryResultDTO;
import com.hzlj.position.config.common.model.JgBj;
import com.hzlj.position.config.mapper.JgBjMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * 机构-行政区划边界(JgBj)表操作类
 *
 * @author lifh
 * @date 2023-10-23 14:09:59
 */
@Repository
public class JgBjDao extends ServiceImpl<JgBjMapper, JgBj> {
    @Resource
    private JgBjMapper jgBjMapper;


    public JgBjQueryResultDTO getXzqhIds(String jgCode) {
        return QueryWrapperConverterPlus.of(jgBjMapper)
                .selectOne(JgBjQueryResultDTO.class, null, null, q -> {
                    q.apply("'" + jgCode + "' LIKE CONCAT(jg_code, '%')")
                            .orderByDesc(JgBj::getJgCode);
                });
    }
}

